// CppBaseType.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <tchar.h>
#include "Animal/dog.h"
#include <WS2tcpip.h>
using namespace std;

int main()
{
	mydog dg;
	dg.getAge();
	
	auto intsize = sizeof(int);
	auto longsize = sizeof(long);
	auto doubsize = sizeof(double);
	auto longlongsize = sizeof(long long);
	auto boolsize = sizeof(bool);

	cout << intsize << "INT max value:" << INT_MAX << endl;
	cout << longsize << "LONG max value:" << LONG_MAX << endl;
	cout << doubsize << "DOU max value:" << DBL_MAX << endl;
	cout << longlongsize << "LONGLONG max value:" << LLONG_MAX << endl;

	cout << longlongsize << "LONGLONG max value:" << LLONG_MAX << endl;
	cout << "ULONG Max:" << ULLONG_MAX << endl;

	cout << "bool size :" << boolsize << endl;

	wchar_t * iamwchar = L"iameamonchen";
	char * iamchar = "iameamonchen";

	cout << "iamwchar size wcslen(iamwchar) :" << wcslen(iamwchar) << endl;

	//	cout << "iamwchar size wcslen(iamwchar) :" << lstrlen(iamwchar) << endl;

	cout << "iamchar size  strlen(iamchar):" << strlen(iamchar) << endl;

	//cout << "iamchar size wcslen(iamchar) :" << lstrlen(iamchar) << endl;

	char * ipbuf = "192.168.0.1";
	ULONG ipaddr;
	auto ret_inet_pton = inet_pton(AF_INET, ipbuf, &ipaddr);

	SOCKADDR_IN address;
	address.sin_addr.s_addr = ipaddr;

	in_addr iaddr;
	iaddr.s_addr = ipaddr;

	cout << "inet_pton :" << ret_inet_pton << endl;

	char ipbuff[MAX_PATH] = { 0 };
	auto ret_inet_ntop = inet_ntop(AF_INET, &ipaddr, ipbuff, MAX_PATH);

	cout << "inet_ntop :" << ret_inet_ntop << endl;

	union _check_cpu
	{
		int a;
		char b;
	};
	_check_cpu _ck;
	_ck.a = 0x10000000;
	_ck.b = 0x07;

	short a = 0x1234;
	int *p = reinterpret_cast<int*>(&a);
	if (p[0] == 0x12)
		return 0; // big endian
	else
		return 1;

	cin.get();
	return 0;
}